import { createRouter, createWebHistory } from 'vue-router'
import homeView from '@/views/home/home.vue'
import loginView from '@/views/login/index.vue'
import registerView from '@/views/login/register.vue'
import indexView from '@/views/home/index.vue'
import ddView from '@/views/home/dd.vue'
import categoriesView from '@/views/home/categories.vue'
import cartView from '@/views/home/cart.vue'
import myView from '@/views/home/my.vue'
import goodsView from '@/views/goods/index.vue'
import detailView from '@/views/detail/index.vue'


const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [

    { path: '/login', name: 'login', component: loginView, },
    { path: '/register', name: 'register', component: registerView, },
    {
      path: '/home', name: 'home', component: homeView, children: [
        { path: 'index', name: 'index', component: indexView, },
        { path: 'categories', name: 'categories', component: categoriesView, },
        { path: 'cart', name: 'cart', component: cartView, },
        { path: 'my', name: 'my', component: myView, },
        { path: 'dd', name: 'dd', component: ddView, },
      ]
    },
    // { path: '/goods/:cat_icon', name: 'goods', component: goodsView, },
    { path: '/goods/:query', name: 'goods', component: goodsView, },
    { path: '/detail/:goods_id', name: 'detail', component: detailView, },

  ],
})

export default router
